package net.sourceforge.wurfl.core.request.normalizer.specific;

import net.sourceforge.wurfl.core.request.normalizer.UserAgentNormalizer;

public class OperaNormalizer implements UserAgentNormalizer {

	
	
	/**
	 * Return the Opera user agent with the major version		
	 *  
	 * e.g 
	 * 	Opera/9.00 (Windows NT 5.1; U; de) -> Opera/9
	 *  Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Opera 7.52 [en] -> Opera 7
	 * 		
	 * @param userAgent
	 * @return String
	 */
	public String normalize(String userAgent) {
		return operaWithMajorVersion(userAgent);
	}
	
	private String operaWithMajorVersion(String userAgent) {
		int index = userAgent.indexOf("Opera");
		return userAgent.substring(index, index+7);
	}



}
